package com.jr.filter;

import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;

@WebFilter("/aaa")
public class CFilter implements Filter {

    @Override
    public void init(FilterConfig filterConfig) throws ServletException {

    }

    @Override
    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
        System.out.println("客户端发送请求,先到达BFilter,在前往Servlet。。。");
        filterChain.doFilter(servletRequest,servletResponse);//继续向下执行()
        System.out.println("Servlet处理完请求,给出响应,先走BFilter,在到达客户端");
    }

    @Override
    public void destroy() {

    }
}
